package com.bawei.day0129.view.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;

import android.os.Bundle;
import android.view.View;

import com.bawei.day0129.Bean.XqBean;
import com.bawei.day0129.R;
import com.bawei.day0129.base.BaseActivity;
import com.bawei.day0129.databinding.ActivityXqBinding;
import com.bawei.day0129.viewmodel.MainViewModel;
import com.bawei.day0129.viewmodel.XqViewmodel;

public class XqActivity extends BaseActivity<XqViewmodel, ActivityXqBinding> {


    @Override
    protected int initLayout() {
        return R.layout.activity_xq;
    }

    @Override
    protected void initView() {
        int id = getIntent().getIntExtra("id", 0);
        viewModel.getLiveData(id).observe(XqActivity.this, new Observer<XqBean>() {
            @Override
            public void onChanged(XqBean xqBean) {
                XqBean.ResultBean result = xqBean.getResult();
                dataBinding.xqRec.getSettings().setUseWideViewPort(true);
                dataBinding.xqRec.getSettings().setLoadWithOverviewMode(true);
                dataBinding.xqRec.loadDataWithBaseURL(null,result.getContent(),"text/html","utf-8",null);
                dataBinding.xqRec.getSettings().setTextZoom(260);
            }
        });
        dataBinding.xqBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}